<template>
    <template v-for="(p, index) in meunlist" :key="p.path">
        <el-sub-menu v-if="(p.children && p.children.length > 0)" :index="p.name">
            <template #title>
                <svg class="icon" aria-hidden="true">
                    <use :xlink:href="'#' + p.meta?.icon"></use>
                </svg>
                <span>{{ p.meta && p.meta.name }}</span>
            </template>
            <yd-com :meunlist="p.children"></yd-com>
        </el-sub-menu>
        <el-menu-item v-else :index="p.name" @click="open(p.name)">
            <svg class="icon" aria-hidden="true">
                <use :xlink:href="'#' + p.meta?.icon"></use>
            </svg>
            <template #title>
                <span>{{ p.meta?.name }}</span>
            </template>
        </el-menu-item>
    </template>
</template>

<script>
export default {
    name: "yd-com",
    props: {
        meunlist: {
            type: Array,
            default() {
                return []
            }

        }
    },
    methods: {
        open(name) {
            console.log(name, "dudu");
            console.log("kkkk");
            this.$router.push({
                name: name
            })

        }
    },
    mounted() {
        console.log(this.meunlist, "meunList");
    }

}
</script>